<template>
<!--基本信息  -->
  <div style="height:520px">
    <FormPanel  
        ref="formPanel"
        :list="initForm"   
        :cols="3"   
        :formType="value.type"       
        :labelWidth="120"  
        :isSubmitBtn="false"  
        @formChange="formChangeHandle"
     />
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
export default {
  mixins: [dictionary],
  props:{
    value: {
      type: Object,
      required: true
    },
  },
  data() {
    return {
      initForm : this.initFormFun(),
      formValue : {}
    };
  },
  mounted() {
    
    console.log(this.value) //获取到行id 、类型（新增、详情）
    //请求接口进行赋值，自己写吧
  },
  methods: {
    //初始化数据
    init(data){
     this.formValue={}
     if(data.type==='edit'){
       this.initForm.forEach(x => {
          x.initialValue = data.row[x.fieldName];
        });
      }
    },
    //搜索数据
    initFormFun(){
        return [{
              type: 'INPUT',
              label: '品牌',
              fieldName: 'field1',
              disabled:true,
              initialValue: ''
            },{
              type: 'INPUT',
              label: '经销商简称',
              fieldName: 'field2',
              placeholder: '请输入',
              initialValue: '',
              rules: [{
                required: true,
                message: '必填',
                trigger: 'blur'
              }]
            },
            {
              type: 'INPUT',
              label: '临时代码',
              fieldName: 'field3',
              disabled:true,
              initialValue: ''
            },
            {
              type: 'TEXT_AREA',
              label: '公司全称',
              fieldName: 'field4',
              rows: 2,
              initialValue: '',
              placeholder: '请输入',
              rules: [{
                required: true,
                message: '必填',
                trigger: 'blur'
              }]
            },
            {
              type: 'SELECT',
              label: '经销商类型',
              fieldName: 'field5',
              placeholder: '请选择',
              initialValue: "",
              itemList: this.createDictList('1008'),
              rules: [{
                required: true,
                message: '必填',
                trigger: 'change'
              }]
            },
            {
              type: 'SELECT',
              label: '经销商级别',
              fieldName: 'field6',
              placeholder: '请选择',
              initialValue: "",
              itemList: this.createDictList('1008'),
              rules: [{
                required: true,
                message: '必填',
                trigger: 'change'
              }]
            },
            {
              type: 'SELECT',
              label: '展厅级别',
              fieldName: 'field7',
              placeholder: '请选择',
              initialValue: "",
              itemList: this.createDictList('1008')
            },
            {
              type: 'SELECT',
              label: '事业部',
              fieldName: 'field8',
              placeholder: '请选择',
              initialValue: "",
              itemList: this.createDictList('1008'),
              rules: [{
                required: true,
                message: '必填',
                trigger: 'change'
              }]
            },{
              type: 'SELECT',
              label: '办事处',
              fieldName: 'field9',
              placeholder: '请选择',
              initialValue: "",
              itemList: this.createDictList('1008'),
              rules: [{
                required: true,
                message: '必填',
                trigger: 'change'
              }]
            },
            {
              type: 'SELECT',
              label: '售后级别',
              fieldName: 'field91',
              placeholder: '请选择',
              initialValue: "",
              itemList: this.createDictList('1008')
            },
            {
              type: 'SELECT',
              label: '省份',
              fieldName: 'field10',
              placeholder: '请选择',
              initialValue: "",
              itemList: this.createDictList('1008'),
              rules: [{
                required: true,
                message: '必填',
                trigger: 'change'
              }]
            },{
              type: 'SELECT',
              label: '城市',
              fieldName: 'field11',
              placeholder: '请选择',
              initialValue: "",
              itemList: this.createDictList('1008'),
              rules: [{
                required: true,
                message: '必填',
                trigger: 'change'
              }]
            },{
              type: 'SELECT',
              label: '县区',
              fieldName: 'field12',
              placeholder: '请选择',
              initialValue: "",
              itemList: this.createDictList('1008'),
              rules: [{
                required: true,
                message: '必填',
                trigger: 'change'
              }]
            },
            {
              type: 'INPUT',
              label: '店端主要联系人',
              fieldName: 'field13',
              initialValue: '',
              rules: [{
                required: true,
                message: '必填',
                trigger: 'blur'
              }]
            },
            {
              type: 'INPUT',
              label: '联系人电话',
              fieldName: 'field14',
              initialValue: '',
              rules: [{
                required: true,
                message: '必填',
                trigger: 'blur'
              }]
            },
            {
              type: 'INPUT',
              label: '店端联系人邮箱',
              fieldName: 'field15',
              initialValue: '',
              rules: [{
                required: true,
                message: '必填',
                trigger: 'blur'
              }]
            },
            {
              type: 'INPUT',
              label: '厂家负责人',
              fieldName: 'field16',
              initialValue: '',
              rules: [{
                required: true,
                message: '必填',
                trigger: 'blur'
              }]
            },
            {
              type: 'INPUT',
              label: '负责人电话',
              fieldName: 'field17',
              initialValue: '',
              rules: [{
                required: true,
                message: '必填',
                trigger: 'blur'
              }]
            },{
              type: 'SELECT',
              label: '建设类型',
              fieldName: 'field18',
              placeholder: '请选择',
              initialValue: "",
              itemList: this.createDictList('1008'),
              rules: [{
                required: true,
                message: '必填',
                trigger: 'change'
              }]
            },
            {
              type: 'INPUT',
              label: '项目设计师',
              fieldName: 'field19',
              initialValue: '',
              rules: [{
                required: true,
                message: '必填',
                trigger: 'blur'
              }]
            },
            {
              type: 'INPUT',
              label: '设计师电话',
              fieldName: 'field20',
              initialValue: '',
              rules: [{
                required: true,
                message: '必填',
                trigger: 'blur'
              }]
            },{
              type: 'SELECT',
              label: '体系内品牌',
              fieldName: 'field21',
              placeholder: '请选择',
              initialValue: "",
              itemList: this.createDictList('1008')
            },
            {
              type: 'TEXT_AREA',
              label: '建设地址',
              fieldName: 'field22',
              rows: 2,
              initialValue: '',
              placeholder: '请输入',
              rules: [{
                required: true,
                message: '必填',
                trigger: 'blur'
              }]
            }
          ]
    },
    formChangeHandle(val){
      this.formValue=val
    }
  },
}
</script>